﻿@{
    Layout = "~/Views/Shared/_MallLayout.cshtml";
    var maker = ViewData["Maker"] as Pay.DTO.task_dto;
}
    <link href="~/Content/css/tokenmall/css/special.css" rel="stylesheet" />
    <body class="page-GeneralTask">
        <div class="task">
            <div class="item">
                <img class="title1" src="~/Content/css/tokenmall/img/a/a2.png" />
                <div class="fn-center fn32">
                    <p class="mt30 mb10">购买创客导购专题内商品成为创客</p>
                    <p class="col-red">领取@(maker.soup_value)马力！</p>
                    <p class="mt20 mb20">
                        <img class="a3" src="~/Content/css/tokenmall/img/a/a3.png" alt="">
                    </p>
                </div>
                <div class="fn-center col-gray2 fn26 text">
                    成为创客即为完成任务，完成后领取@(maker.soup_value)马力。
                    赠送的马力为时效马力，有效期 @(maker.limit_day)天到期自动失效。每个拓垦账号仅允许领取一次。
                </div>
            </div>
            <div class="fn26 title2 mt20">
                获得+@(maker.soup_value)马力
            </div>
            <div class="fn-center">
                @if (maker.is_complete) {
                    <a class="title3 disabled" id="recive" href="javascript:;">恭喜你已经完成该任务</a>
                } else {
                    if (maker.task_status == 2) {
                        <a class="title3 disabled" id="recive" href="@Url.Action("Index","ProductTokenMaker")"> 完成创客任务才可获取（+@maker.soup_value 马力）</a>
                    } else {
                        <a class="title3 " id="recive" href="javascript:;">领取马力</a>
                    }
                }

            </div>
            @*<div class="item mt30">
                <img class="title4" src="~/Content/css/tokenmall/img/a/a5.png" />
                <div class="li">
                    <i class="iconLi"></i>
                    <div class="tit fn28">活动时间</div>
                    <p class="col-gray2 fn26">12月6日至12月31日</p>
                </div>
                <div class="li">
                    <i class="iconLi"></i>
                    <div class="tit fn28">活动说明</div>
                    <p class="col-gray2 fn26">
                        <i></i>12月6日当天成为创客领取100马力后额外赠送298马力。
                    </p>
                    <p class="col-gray2 fn26">
                        <i></i>12月7日额外赠送的马力减少10点，升级只能获得额外
                        赠送288马力
                    </p>
                    <p class="col-gray2 fn26">
                        <i></i>以此类推递减一直减到12月31日止，
                        越早升级获得马力越多！
                    </p>
                </div>
            </div>*@
        </div>
        <script type="text/javascript">
        var flag = false;
        $("#recive").click(function () {
            var that = $(this);
            if (that.hasClass("disabled")) return;
             if (flag) return;
            flag = true;
            that.addClass("disabled").text("领取中");
            $.ajax({
                //几个参数需要注意一下
                type: "POST",//方法类型
                dataType: "json",//预期服务器返回的数据类型
                url: "/Task/MakerPost",//url
                data: {},
                success: function (result) {
                    if (result.result_code == 1000) {
                        layer.msg("领取成功");
                        window.location.reload();
                    } else {
                        layer.msg(result.result_msg);
                    }
                    flag = false;
                    that.removeClass("disabled").text("领取（+@maker.soup_value 马力）");
                },
                error: function () {
                    layer.msg("异常！");
                    flag = false;
                    that.removeClass("disabled").text("领取（+@maker.soup_value 马力）");
                }
            });
        });
        </script>
    </body>
